public class Leet392 {
    public static void main(String[] args) {
        Leet392 l = new Leet392();
        System.out.println(l.isSubsequence(
                "axc","ahbgdc"));
    }
    public boolean isSubsequence(String s, String t) {
        if (s.length()==0)
            return true;
        char[] chs = t.toCharArray();
        char[] chs2 = s.toCharArray();
        int num = 0;
        int len = chs2.length;
        for (int i = 0; i < chs.length; i++) {
            if (chs[i]==chs2[num])
                num++;
            if (num==len)
                return true;
        }
        return false;
    }
}
